const express = require('express');
const app = express();


app.use(express.static('public'))
//配置跨域
app.all('*', function (req, res, next) {
    res.header('Access-Control-Allow-Origin', '*');
    res.header('Access-Control-Allow-Headers', 'Content-Type');
    res.header('Access-Control-Allow-Methods', '*');
    res.header('Content-Type', 'application/json;charset=utf-8');
    next();
});
// 获取电影列表页底部数据
app.get('/movielist', (req, res) => {
    const data = [
        {
            id: 01,
            name: "狩猎",
            year: "2012",
            image: "http://localhost:3000/images/01.webp",
            swipe: [
                "http://localhost:3000/images/02.webp",
                "http://localhost:3000/images/03.webp",
                "http://localhost:3000/images/04.webp",
                "http://localhost:3000/images/05.webp",
            ],
            small_tags: "2012/丹麦 瑞典/剧情/托马斯·温特伯格",
            big_tags: ['豆瓣电影top250', '戛纳电影节最佳男演员', '悬疑 心理'],
            comments: [
                { content: '其实小孩子最邪恶，因为他们完全不知道行动的后果。', user: '文西' }
            ]
        },
        {
            id: 02,
            name: "救命解药",
            year: "2016",
            image: "http://localhost:3000/images/06.webp",
            swipe: [
                "http://localhost:3000/images/07.webp",
                "http://localhost:3000/images/08.webp",
                "http://localhost:3000/images/09.webp",
                "http://localhost:3000/images/10.webp",
            ],
            small_tags: "2016/美国 德国/悬疑 惊悚/戈尔·维宾斯基",
            big_tags: ['冷门佳作惊悚片', '美国 惊悚 悬疑'],
            comments: [
                { content: '每一帧画面都如诗一般', user: 'Nichole' }
            ]
        },
        {
            id: 03,
            name: "穿越大吉岭",
            year: "2007",
            image: "http://localhost:3000/images/11.webp",
            swipe: [
                "http://localhost:3000/images/12.webp",
                "http://localhost:3000/images/13.webp",
                "http://localhost:3000/images/14.webp",
                "http://localhost:3000/images/15.webp",
            ],
            small_tags: "2012/美国/剧情 喜剧 冒险/韦斯·安德森",
            big_tags: ['心灵之旅', '韦斯·安德森'],
            comments: [
                { content: '安德森的冷幽默让人欲罢不能', user: '陀螺凡达克' }
            ]
        },
    ]
    res.send(data)
})



app.listen(3000, () => {
    console.log('3000');
})